<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>Phone Show</title>
    </head>
    <body>
        <script>
            /*
             * Ext JS Library 2.0.2
             * Copyright(c) 2006-2008, Ext JS, LLC.
             * licensing@extjs.com
             *
             * http://extjs.com/license
             */
            var itemArr = [];
            var activeTab_num = 0;
            var orderid = '<%=@orderid%>';
            var phone_number = '<%=@phone_number%>';
            var checkAir2_option = '<%=@option%>';
            var check_air_clicked = false;
            var customer_info_clikced = false;
            Ext.onReady(function(){
                if (orderid != "") {
                    activeTab_num = 4;
                    if (checkAir2_option=="mod"){
                        checkAir2_tab_title = "修改航段";
                    }else if (checkAir2_option=="add"){
                        checkAir2_tab_title = "追加航段";
                    }else{
                        checkAir2_tab_title = "改签";
                    }
                    itemArr = [{
                            id: 'phoneshow_tab0',
                            title: '来电用户信息',
                            autoLoad: {
                                url: "/customers/customerInfoByID?type=<%=@type%>&phone_number="+phone_number,
                                scripts: true
                            },
                            listeners: {
                                activate: handleActivate
                            }
                        }, {
                            id: 'phoneshow_tab1',
                            title: '查票',
                            autoLoad: {
                                url: '/index/checkAir?phone_number='+phone_number,
                                scripts: true
                            },
                            listeners: {
                                activate: handleActivate
                            }
                        }, {
                            id: 'phoneshow_tab2',
                            title: '联程查询',
                            autoLoad: {
                                url: '/index/checkZjly?phone_number='+phone_number,
                                scripts: true
                            },
                            listeners: {
                                activate: handleActivate
                            }
                        }, {
                            id: 'phoneshow_tab3',
                            title: '酒店预定',
                            autoLoad: {
                                url: '/orders/hotelBooking?phone_number='+phone_number,
                                scripts: true
                            },
                            listeners: {
                                activate: handleActivate
                            }
                        }, {
                            id: 'checkAir2_tab',
                            title: checkAir2_tab_title,
                            autoLoad: {
                                url: '/index/checkAir2?orderid=' + orderid,
                                scripts: true
                            },
                            closable: true,
                            listeners: {
                                activate: handleActivate
                            }
                        }];
                }
                else {
                    if (phone_number=="0"){
                        activeTab_num = 1;
                    }
                    itemArr = [{
                            id: 'phoneshow_tab0',
                            title: '来电用户信息',
                            autoLoad: {
                                url: "/customers/customerInfoByID?type=<%=@type%>&phone_number="+phone_number,
                                scripts: true
                            },
                            listeners: {
                                activate: handleActivate
                            }
                        }, {
                            id: 'phoneshow_tab1',
                            title: '查票',
                            autoLoad: {
                                url: '/index/checkAir?phone_number='+phone_number,
                                scripts: true
                            },
                            listeners: {
                                activate: handleActivate
                            }
                        }, {
                            id: 'phoneshow_tab2',
                            title: '联程查询',
                            autoLoad: {
                                url: '/index/checkZjly?phone_number='+phone_number,
                                scripts: true
                            },
                            listeners: {
                                activate: handleActivate
                            }
                        }, {
                            id: 'phoneshow_tab3',
                            title: '酒店预定',
                            autoLoad: {
                                url: '/orders/hotelBooking?phone_number='+phone_number,
                                scripts: true
                            },
                            listeners: {
                                activate: handleActivate
                            }
                        }];
                }
                var tabHeight = 565;
                if (window.screen) {
                    var h = screen.height;
                    if (h > 900) {
                        tabHeight = 800;
                    }
                    else if (h>800){
                        tabHeight = 700;
                    }
                }
                var tabs = new Ext.TabPanel({
                    id: 'tabs',
                    renderTo: document.body,
                    activeTab: activeTab_num,
                    width: '100%',
                    height: tabHeight,
                    plain: true,
                    defaults: {
                        autoScroll: true
                    },
                    items: itemArr
                });
                function handleActivate(tab){
                    if (!check_air_clicked && tab.getId()=="phoneshow_tab1"){
                        check_air_clicked=true;
                    }
                    if (!check_air_clicked && tab.getId()=="phoneshow_tab0"){
                        customer_info_clikced=true;
                    }
                    /*
                    var new_order = Ext.getCmp('new_order');
                    if (new_order) {
                        Ext.getCmp('tabs').remove('new_order');
                    }
                     */
                }

            });
        </script>
    </body>
</html>
